<?php 
$GLOBALS['Md'] = "MF93FL27";
$GLOBALS['Pd'] = "B";
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/MF93FL27/modconf.mex");
MYTCONN();
	// --- Print Board Requests
	echo '<div class="title">Agentes | ';
	mn_field('button','ED','new_entry','Novo Agente','','','','BUTTON" 
		onclick="modalwindow(\'Novo Agente\',\''.$MODURL.'lib/agente_prop.php\',400,400);'); 
	//  Make Panel
	$GET = $GLOBALS['MYT']->db_array("SELECT sleID AS O_ID, sleName AS COL1, sleType AS COL2, sleDateStart AS COL3, sleDateEnd AS COL4, sleFlag AS COL5 FROM sellers");
	$CARD = $GET[0]; ?>
	</div>
<script charset="utf-8" type="text/javascript">
disableSelection(document.getElementById("BoardPanel"));

Ext.onReady(function(){

 $elem = 200;
 var  windowWidth = 0, windowHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	windowWidth = window.innerWidth
	windowHeight = window.innerHeight-$elem;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight-$elem;
  } 

    Ext.QuickTips.init();

    var myData = [
	<?php   
	for ($i=1;$i<=$CARD;$i++) { 
	echo '['.$i.','.$GET[$i]['O_ID'].',\''.$GET[$i]['COL1'].'\',\''.$GET[$i]['COL2'].'\',\''.$GET[$i]['COL3'].'\',\''.$GET[$i]['COL4'].'\',\''.$GET[$i]['COL5'].'\']';
		if ($i<$CARD) {
			echo ',';
		}
    } ?>
    ];

    var ds = new Ext.data.Store({
        reader: new Ext.data.ArrayReader({}, [
               {name: 'id'},
			   {name: 'O_ID', type: 'int'},
               {name: 'COL1', type: 'string'},
               {name: 'COL2', type: 'string'},
               {name: 'COL3', type: 'string'},
			   {name: 'COL4', type: 'string'},
               {name: 'COL5', type: 'string'}
          ])
    });
    ds.loadData(myData);
    var colModel = new Ext.grid.ColumnModel([
        {header: "Número", width: 80, sortable: true, locked:true, dataIndex: 'O_ID'},
        {header: "Nome", width: 200, sortable: true, dataIndex: 'COL1'},
        {header: "Tipo", width: 80, sortable: true, locked:true, dataIndex: 'COL2'},
        {header: "Data Início", width: 120, sortable: true, locked:true,dataIndex: 'COL3'},
        {header: "Data Termino", width: 120, sortable: true, locked:true,dataIndex: 'COL4'},
        {header: "Estado", width: 100, sortable: true, locked:true,dataIndex: 'COL5'}
    ]);

   var selmode = new Ext.grid.RowSelectionModel({});
   var Console = new Ext.grid.GridPanel({
	    ds: ds,
	    cm: colModel,
	    sm: selmode,
		listeners: {
			rowdblclick: function(ds, row) { 
			var record = ds.getStore().getAt(row);
			var value = record.get('O_ID');	

			 }
		},
	    height: windowHeight,
	    border: true,
        renderTo: 'BoardPanel'
    });
});
</script>
<div id="BoardPanel"></div>